{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "5489635b",
   "metadata": {},
   "source": [
    "## 11.7. AdaGrad算法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7b42c700",
   "metadata": {},
   "source": [
    "### 11.7.3. 算法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1a64f376",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch 20, x1: -2.382563, x2: -0.158591\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"245.120313pt\" height=\"180.65625pt\" viewBox=\"0 0 245.120313 180.65625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-03-03T02:14:25.787920</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.5.1, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 180.65625 \n",
       "L 245.120313 180.65625 \n",
       "L 245.120313 0 \n",
       "L 0 0 \n",
       "L 0 180.65625 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 42.620312 143.1 \n",
       "L 237.920313 143.1 \n",
       "L 237.920313 7.2 \n",
       "L 42.620312 7.2 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <defs>\n",
       "       <path id=\"m8f9d3dcfb5\" d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m8f9d3dcfb5\" x=\"88.393749\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- −4 -->\n",
       "      <g transform=\"translate(81.022656 157.698438)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \n",
       "L 4684 2272 \n",
       "L 4684 1741 \n",
       "L 678 1741 \n",
       "L 678 2272 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
       "L 825 1625 \n",
       "L 2419 1625 \n",
       "L 2419 4116 \n",
       "z\n",
       "M 2253 4666 \n",
       "L 3047 4666 \n",
       "L 3047 1625 \n",
       "L 3713 1625 \n",
       "L 3713 1100 \n",
       "L 3047 1100 \n",
       "L 3047 0 \n",
       "L 2419 0 \n",
       "L 2419 1100 \n",
       "L 313 1100 \n",
       "L 313 1709 \n",
       "L 2253 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-34\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m8f9d3dcfb5\" x=\"149.424998\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- −2 -->\n",
       "      <g transform=\"translate(142.053905 157.698438)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m8f9d3dcfb5\" x=\"210.456247\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 0 -->\n",
       "      <g transform=\"translate(207.274997 157.698438)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_4\">\n",
       "     <!-- x1 -->\n",
       "     <g transform=\"translate(134.129687 171.376563)scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \n",
       "L 2247 1797 \n",
       "L 3578 0 \n",
       "L 2900 0 \n",
       "L 1881 1375 \n",
       "L 863 0 \n",
       "L 184 0 \n",
       "L 1544 1831 \n",
       "L 300 3500 \n",
       "L 978 3500 \n",
       "L 1906 2253 \n",
       "L 2834 3500 \n",
       "L 3513 3500 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-78\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"59.179688\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <defs>\n",
       "       <path id=\"m0f9dad4233\" d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0f9dad4233\" x=\"42.620312\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- −3 -->\n",
       "      <g transform=\"translate(20.878125 146.899219)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \n",
       "Q 3050 2419 3304 2112 \n",
       "Q 3559 1806 3559 1356 \n",
       "Q 3559 666 3084 287 \n",
       "Q 2609 -91 1734 -91 \n",
       "Q 1441 -91 1130 -33 \n",
       "Q 819 25 488 141 \n",
       "L 488 750 \n",
       "Q 750 597 1062 519 \n",
       "Q 1375 441 1716 441 \n",
       "Q 2309 441 2620 675 \n",
       "Q 2931 909 2931 1356 \n",
       "Q 2931 1769 2642 2001 \n",
       "Q 2353 2234 1838 2234 \n",
       "L 1294 2234 \n",
       "L 1294 2753 \n",
       "L 1863 2753 \n",
       "Q 2328 2753 2575 2939 \n",
       "Q 2822 3125 2822 3475 \n",
       "Q 2822 3834 2567 4026 \n",
       "Q 2313 4219 1838 4219 \n",
       "Q 1578 4219 1281 4162 \n",
       "Q 984 4106 628 3988 \n",
       "L 628 4550 \n",
       "Q 988 4650 1302 4700 \n",
       "Q 1616 4750 1894 4750 \n",
       "Q 2613 4750 3031 4423 \n",
       "Q 3450 4097 3450 3541 \n",
       "Q 3450 3153 3228 2886 \n",
       "Q 3006 2619 2597 2516 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0f9dad4233\" x=\"42.620312\" y=\"108.253847\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- −2 -->\n",
       "      <g transform=\"translate(20.878125 112.053066)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0f9dad4233\" x=\"42.620312\" y=\"73.407694\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- −1 -->\n",
       "      <g transform=\"translate(20.878125 77.206913)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-31\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0f9dad4233\" x=\"42.620312\" y=\"38.561541\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 0 -->\n",
       "      <g transform=\"translate(29.257812 42.36076)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_9\">\n",
       "     <!-- x2 -->\n",
       "     <g transform=\"translate(14.798437 81.290625)rotate(-90)scale(0.1 -0.1)\">\n",
       "      <use xlink:href=\"#DejaVuSans-78\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-32\" x=\"59.179688\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_8\">\n",
       "    <path d=\"M 57.878125 108.253847 \n",
       "L 70.084368 94.315386 \n",
       "L 78.348688 85.608098 \n",
       "L 84.908014 79.10841 \n",
       "L 90.45961 73.910731 \n",
       "L 95.325824 69.601349 \n",
       "L 99.686584 65.949502 \n",
       "L 103.654326 62.810091 \n",
       "L 107.304851 60.084214 \n",
       "L 110.692125 57.70041 \n",
       "L 113.85619 55.604727 \n",
       "L 116.827732 53.755024 \n",
       "L 119.630891 52.11749 \n",
       "L 122.285061 50.664408 \n",
       "L 124.806114 49.372667 \n",
       "L 127.207234 48.222727 \n",
       "L 129.499517 47.197884 \n",
       "L 131.692414 46.283727 \n",
       "L 133.794049 45.467735 \n",
       "L 135.811474 44.738966 \n",
       "L 137.750856 44.087812 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "    <defs>\n",
       "     <path id=\"m4a279fd463\" d=\"M 0 3 \n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \n",
       "C 2.683901 1.55874 3 0.795609 3 0 \n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \n",
       "z\n",
       "\" style=\"stroke: #ff7f0e\"/>\n",
       "    </defs>\n",
       "    <g clip-path=\"url(#pbd706e7771)\">\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"57.878125\" y=\"108.253847\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"70.084368\" y=\"94.315386\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"78.348688\" y=\"85.608098\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"84.908014\" y=\"79.10841\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"90.45961\" y=\"73.910731\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"95.325824\" y=\"69.601349\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"99.686584\" y=\"65.949502\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"103.654326\" y=\"62.810091\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"107.304851\" y=\"60.084214\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"110.692125\" y=\"57.70041\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"113.85619\" y=\"55.604727\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"116.827732\" y=\"53.755024\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"119.630891\" y=\"52.11749\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"122.285061\" y=\"50.664408\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"124.806114\" y=\"49.372667\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"127.207234\" y=\"48.222727\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"129.499517\" y=\"47.197884\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"131.692414\" y=\"46.283727\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"133.794049\" y=\"45.467735\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"135.811474\" y=\"44.738966\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m4a279fd463\" x=\"137.750856\" y=\"44.087812\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_1\">\n",
       "    <path d=\"M 210.456247 38.561541 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_2\">\n",
       "    <path d=\"M 237.920312 80.648724 \n",
       "L 234.868753 80.767201 \n",
       "L 231.817193 80.87174 \n",
       "L 228.765619 80.96234 \n",
       "L 225.71406 81.039001 \n",
       "L 222.6625 81.101725 \n",
       "L 219.610941 81.150509 \n",
       "L 216.559381 81.185356 \n",
       "L 213.507807 81.206264 \n",
       "L 210.456247 81.213233 \n",
       "L 207.404688 81.206264 \n",
       "L 204.353128 81.185356 \n",
       "L 201.301569 81.150509 \n",
       "L 198.249995 81.101725 \n",
       "L 195.198435 81.039001 \n",
       "L 192.146876 80.96234 \n",
       "L 189.095316 80.87174 \n",
       "L 186.043757 80.767202 \n",
       "L 182.992182 80.648724 \n",
       "L 179.940623 80.51631 \n",
       "L 177.03433 80.376922 \n",
       "L 176.889063 80.369349 \n",
       "L 173.837504 80.195118 \n",
       "L 170.785944 80.005738 \n",
       "L 167.73437 79.801205 \n",
       "L 164.682811 79.581524 \n",
       "L 161.631251 79.34669 \n",
       "L 158.579684 79.096707 \n",
       "L 155.528125 78.831575 \n",
       "L 152.476565 78.551289 \n",
       "L 149.424998 78.255854 \n",
       "L 146.373439 77.94527 \n",
       "L 143.321872 77.619534 \n",
       "L 140.270312 77.278647 \n",
       "L 137.218753 76.922611 \n",
       "L 136.969649 76.89231 \n",
       "L 134.167186 76.518958 \n",
       "L 131.115627 76.095827 \n",
       "L 128.06406 75.6561 \n",
       "L 125.0125 75.199783 \n",
       "L 121.960941 74.726871 \n",
       "L 118.909374 74.237364 \n",
       "L 115.857814 73.731266 \n",
       "L 113.968754 73.407694 \n",
       "L 112.806247 73.187612 \n",
       "L 109.754688 72.59156 \n",
       "L 106.703128 71.977167 \n",
       "L 103.651562 71.344435 \n",
       "L 100.600002 70.693362 \n",
       "L 97.548443 70.02395 \n",
       "L 97.100855 69.923074 \n",
       "L 94.496876 69.26715 \n",
       "L 91.445309 68.477985 \n",
       "L 88.393749 67.668327 \n",
       "L 85.34219 66.838168 \n",
       "L 83.908318 66.438462 \n",
       "L 82.29063 65.927389 \n",
       "L 79.239056 64.940075 \n",
       "L 76.187497 63.929538 \n",
       "L 73.307377 62.95385 \n",
       "L 73.135937 62.886836 \n",
       "L 70.084378 61.66722 \n",
       "L 67.032818 60.420802 \n",
       "L 64.752163 59.469229 \n",
       "L 63.981244 59.089091 \n",
       "L 60.929684 57.552694 \n",
       "L 57.878125 55.984618 \n",
       "L 54.826565 54.029365 \n",
       "L 52.486033 52.499997 \n",
       "L 51.775006 51.902647 \n",
       "L 48.723432 49.289169 \n",
       "L 48.409729 49.015385 \n",
       "L 45.671872 45.670156 \n",
       "L 45.55989 45.530773 \n",
       "L 43.880133 42.046153 \n",
       "L 43.320214 38.561541 \n",
       "L 43.880133 35.076921 \n",
       "L 45.55989 31.592309 \n",
       "L 45.671872 31.452926 \n",
       "L 48.409729 28.107697 \n",
       "L 48.723432 27.833913 \n",
       "L 51.775006 25.220438 \n",
       "L 52.486047 24.623076 \n",
       "L 54.826565 23.093718 \n",
       "L 57.878125 21.138465 \n",
       "L 60.929684 19.570388 \n",
       "L 63.981244 18.033991 \n",
       "L 64.752179 17.653844 \n",
       "L 67.032818 16.702279 \n",
       "L 70.084378 15.455861 \n",
       "L 73.135937 14.236246 \n",
       "L 73.307377 14.169232 \n",
       "L 76.187497 13.193544 \n",
       "L 79.239056 12.183007 \n",
       "L 82.29063 11.195693 \n",
       "L 83.908318 10.68462 \n",
       "L 85.34219 10.284914 \n",
       "L 88.393749 9.454754 \n",
       "L 91.445309 8.645096 \n",
       "L 94.496876 7.855932 \n",
       "L 97.100893 7.2 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_3\">\n",
       "    <path d=\"M 237.920312 98.491946 \n",
       "L 234.868753 98.576571 \n",
       "L 231.817193 98.651241 \n",
       "L 228.765619 98.715958 \n",
       "L 225.71406 98.770714 \n",
       "L 222.6625 98.815518 \n",
       "L 219.610941 98.850364 \n",
       "L 216.559381 98.875252 \n",
       "L 213.507807 98.890188 \n",
       "L 210.456247 98.895165 \n",
       "L 207.404688 98.890188 \n",
       "L 204.353128 98.875252 \n",
       "L 201.301569 98.850364 \n",
       "L 198.249995 98.815518 \n",
       "L 195.198435 98.770714 \n",
       "L 192.146876 98.715958 \n",
       "L 189.095316 98.651243 \n",
       "L 186.043757 98.576571 \n",
       "L 182.992182 98.491946 \n",
       "L 179.940623 98.397363 \n",
       "L 176.889063 98.292825 \n",
       "L 173.837504 98.17833 \n",
       "L 170.785944 98.053878 \n",
       "L 167.73437 97.919472 \n",
       "L 165.208907 97.799999 \n",
       "L 164.682811 97.773602 \n",
       "L 161.631251 97.60993 \n",
       "L 158.579684 97.435699 \n",
       "L 155.528125 97.25091 \n",
       "L 152.476565 97.055559 \n",
       "L 149.424998 96.84965 \n",
       "L 146.373439 96.633182 \n",
       "L 143.321872 96.406153 \n",
       "L 140.270312 96.168568 \n",
       "L 137.218753 95.920421 \n",
       "L 134.167186 95.661713 \n",
       "L 131.115627 95.392447 \n",
       "L 128.06406 95.112622 \n",
       "L 125.0125 94.822238 \n",
       "L 121.960941 94.521293 \n",
       "L 119.943827 94.315387 \n",
       "L 118.909374 94.202977 \n",
       "L 115.857814 93.860137 \n",
       "L 112.806247 93.506054 \n",
       "L 109.754688 93.140732 \n",
       "L 106.703128 92.764169 \n",
       "L 103.651562 92.376366 \n",
       "L 100.600002 91.977321 \n",
       "L 97.548443 91.567036 \n",
       "L 94.496876 91.145509 \n",
       "L 92.277554 90.830771 \n",
       "L 91.445309 90.704604 \n",
       "L 88.393749 90.229975 \n",
       "L 85.34219 89.743331 \n",
       "L 82.29063 89.244671 \n",
       "L 79.239056 88.733993 \n",
       "L 76.187497 88.211301 \n",
       "L 73.135937 87.676594 \n",
       "L 71.291579 87.346154 \n",
       "L 70.084378 87.113848 \n",
       "L 67.032818 86.51372 \n",
       "L 63.981244 85.900684 \n",
       "L 60.929684 85.274745 \n",
       "L 57.878125 84.635899 \n",
       "L 54.826565 83.984148 \n",
       "L 54.263641 83.861538 \n",
       "L 51.775006 83.276125 \n",
       "L 48.723432 82.544352 \n",
       "L 45.671872 81.798649 \n",
       "L 42.620312 81.039001 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_4\">\n",
       "    <path d=\"M 237.920312 112.139599 \n",
       "L 234.868753 112.208481 \n",
       "L 231.817193 112.269261 \n",
       "L 228.765619 112.321933 \n",
       "L 225.71406 112.366507 \n",
       "L 222.6625 112.402973 \n",
       "L 219.610941 112.431336 \n",
       "L 216.559381 112.451596 \n",
       "L 213.507807 112.463748 \n",
       "L 210.456247 112.467802 \n",
       "L 207.404688 112.463748 \n",
       "L 204.353128 112.451596 \n",
       "L 201.301569 112.431336 \n",
       "L 198.249995 112.402973 \n",
       "L 195.198435 112.366507 \n",
       "L 192.146876 112.321933 \n",
       "L 189.095316 112.269261 \n",
       "L 186.043757 112.208481 \n",
       "L 182.992182 112.139599 \n",
       "L 179.940623 112.062613 \n",
       "L 176.889063 111.977524 \n",
       "L 173.837504 111.884331 \n",
       "L 170.785944 111.783036 \n",
       "L 169.542551 111.738459 \n",
       "L 167.73437 111.670471 \n",
       "L 164.682811 111.547234 \n",
       "L 161.631251 111.415502 \n",
       "L 158.579684 111.275267 \n",
       "L 155.528125 111.12653 \n",
       "L 152.476565 110.969299 \n",
       "L 149.424998 110.803569 \n",
       "L 146.373439 110.629336 \n",
       "L 143.321872 110.446605 \n",
       "L 140.270312 110.255376 \n",
       "L 137.218753 110.055648 \n",
       "L 134.167186 109.847422 \n",
       "L 131.115627 109.630697 \n",
       "L 128.06406 109.40547 \n",
       "L 125.0125 109.171745 \n",
       "L 121.960941 108.929524 \n",
       "L 118.909374 108.678802 \n",
       "L 115.857814 108.419577 \n",
       "L 113.968762 108.253847 \n",
       "L 112.806247 108.146627 \n",
       "L 109.754688 107.856244 \n",
       "L 106.703128 107.556924 \n",
       "L 103.651562 107.248668 \n",
       "L 100.600002 106.931482 \n",
       "L 97.548443 106.605357 \n",
       "L 94.496876 106.270297 \n",
       "L 91.445309 105.926302 \n",
       "L 88.393749 105.573374 \n",
       "L 85.34219 105.211509 \n",
       "L 82.29063 104.840713 \n",
       "L 81.716196 104.769231 \n",
       "L 79.239056 104.444313 \n",
       "L 76.187497 104.034636 \n",
       "L 73.135937 103.615542 \n",
       "L 70.084378 103.187029 \n",
       "L 67.032818 102.749098 \n",
       "L 63.981244 102.301748 \n",
       "L 60.929684 101.84498 \n",
       "L 57.878125 101.378796 \n",
       "L 57.273841 101.284615 \n",
       "L 54.826565 100.881398 \n",
       "L 51.775006 100.368663 \n",
       "L 48.723432 99.845968 \n",
       "L 45.671872 99.313318 \n",
       "L 42.620312 98.770713 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_5\">\n",
       "    <path d=\"M 237.920312 123.611044 \n",
       "L 234.868753 123.671492 \n",
       "L 231.817193 123.724829 \n",
       "L 228.765619 123.771052 \n",
       "L 225.71406 123.810168 \n",
       "L 222.6625 123.842169 \n",
       "L 219.610941 123.867058 \n",
       "L 216.559381 123.884838 \n",
       "L 213.507807 123.895502 \n",
       "L 210.456247 123.899059 \n",
       "L 207.404688 123.895502 \n",
       "L 204.353128 123.884838 \n",
       "L 201.301569 123.867058 \n",
       "L 198.249995 123.842169 \n",
       "L 195.198435 123.810168 \n",
       "L 192.146876 123.771052 \n",
       "L 189.095316 123.724829 \n",
       "L 186.043757 123.671492 \n",
       "L 182.992182 123.611044 \n",
       "L 179.940623 123.543485 \n",
       "L 176.889063 123.468815 \n",
       "L 173.837504 123.387034 \n",
       "L 170.785944 123.298143 \n",
       "L 167.73437 123.202136 \n",
       "L 164.682811 123.099019 \n",
       "L 161.631251 122.988795 \n",
       "L 158.579684 122.871456 \n",
       "L 155.528125 122.747002 \n",
       "L 152.476565 122.615441 \n",
       "L 149.424998 122.47677 \n",
       "L 146.373439 122.330983 \n",
       "L 143.605784 122.192312 \n",
       "L 143.321872 122.177481 \n",
       "L 140.270312 122.010664 \n",
       "L 137.218753 121.836433 \n",
       "L 134.167186 121.654789 \n",
       "L 131.115627 121.465731 \n",
       "L 128.06406 121.269256 \n",
       "L 125.0125 121.065368 \n",
       "L 121.960941 120.85407 \n",
       "L 118.909374 120.635354 \n",
       "L 115.857814 120.409222 \n",
       "L 112.806247 120.175679 \n",
       "L 109.754688 119.934723 \n",
       "L 106.703128 119.68635 \n",
       "L 103.651562 119.430563 \n",
       "L 100.600002 119.167366 \n",
       "L 97.548443 118.896753 \n",
       "L 95.473374 118.707691 \n",
       "L 94.496876 118.614768 \n",
       "L 91.445309 118.316641 \n",
       "L 88.393749 118.010767 \n",
       "L 85.34219 117.697155 \n",
       "L 82.29063 117.375795 \n",
       "L 79.239056 117.046693 \n",
       "L 76.187497 116.709847 \n",
       "L 73.135937 116.365258 \n",
       "L 70.084378 116.012923 \n",
       "L 67.032818 115.652848 \n",
       "L 63.981244 115.285027 \n",
       "L 63.477901 115.223079 \n",
       "L 60.929684 114.894876 \n",
       "L 57.878125 114.49374 \n",
       "L 54.826565 114.084501 \n",
       "L 51.775006 113.667159 \n",
       "L 48.723432 113.24171 \n",
       "L 45.671872 112.808158 \n",
       "L 42.620312 112.366503 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_6\">\n",
       "    <path d=\"M 237.920312 133.720047 \n",
       "L 234.868753 133.773901 \n",
       "L 231.817193 133.82142 \n",
       "L 228.765619 133.8626 \n",
       "L 225.71406 133.897448 \n",
       "L 222.6625 133.925958 \n",
       "L 219.610941 133.948133 \n",
       "L 216.559381 133.963973 \n",
       "L 213.507807 133.973474 \n",
       "L 210.456247 133.976643 \n",
       "L 207.404688 133.973474 \n",
       "L 204.353128 133.963973 \n",
       "L 201.301569 133.948133 \n",
       "L 198.249995 133.925958 \n",
       "L 195.198435 133.897448 \n",
       "L 192.146876 133.8626 \n",
       "L 189.095316 133.82142 \n",
       "L 186.043757 133.773901 \n",
       "L 182.992182 133.720047 \n",
       "L 179.940623 133.659858 \n",
       "L 176.889063 133.593334 \n",
       "L 173.837504 133.520475 \n",
       "L 170.785944 133.44128 \n",
       "L 167.73437 133.355747 \n",
       "L 164.682811 133.263879 \n",
       "L 161.631251 133.165679 \n",
       "L 158.579684 133.061141 \n",
       "L 155.528125 132.950264 \n",
       "L 152.476565 132.833055 \n",
       "L 149.424998 132.709511 \n",
       "L 147.936483 132.646156 \n",
       "L 146.373439 132.577118 \n",
       "L 143.321872 132.43576 \n",
       "L 140.270312 132.287829 \n",
       "L 137.218753 132.133322 \n",
       "L 134.167186 131.972242 \n",
       "L 131.115627 131.804587 \n",
       "L 128.06406 131.630355 \n",
       "L 125.0125 131.449549 \n",
       "L 121.960941 131.262171 \n",
       "L 118.909374 131.068216 \n",
       "L 115.857814 130.867686 \n",
       "L 112.806247 130.660581 \n",
       "L 109.754688 130.446903 \n",
       "L 106.703128 130.226648 \n",
       "L 103.651562 129.999818 \n",
       "L 100.600002 129.766418 \n",
       "L 97.548443 129.52644 \n",
       "L 94.496876 129.279885 \n",
       "L 93.070115 129.161535 \n",
       "L 91.445309 129.021473 \n",
       "L 88.393749 128.751584 \n",
       "L 85.34219 128.474867 \n",
       "L 82.29063 128.191314 \n",
       "L 79.239056 127.900929 \n",
       "L 76.187497 127.603712 \n",
       "L 73.135937 127.299663 \n",
       "L 70.084378 126.988779 \n",
       "L 67.032818 126.671065 \n",
       "L 63.981244 126.346517 \n",
       "L 60.929684 126.015136 \n",
       "L 57.878125 125.676924 \n",
       "L 54.826565 125.317796 \n",
       "L 51.775006 124.951557 \n",
       "L 48.723432 124.578203 \n",
       "L 45.671872 124.197739 \n",
       "L 42.620312 123.810168 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_7\">\n",
       "    <path d=\"M 210.456247 143.1 \n",
       "L 207.404688 143.097049 \n",
       "L 204.353128 143.088189 \n",
       "L 201.301569 143.07342 \n",
       "L 198.249995 143.052749 \n",
       "L 195.198435 143.026175 \n",
       "L 192.146876 142.993692 \n",
       "L 189.095316 142.9553 \n",
       "L 186.043757 142.911006 \n",
       "L 182.992182 142.860804 \n",
       "L 179.940623 142.804692 \n",
       "L 176.889063 142.742678 \n",
       "L 173.837504 142.674761 \n",
       "L 170.785944 142.60093 \n",
       "L 167.73437 142.521202 \n",
       "L 164.682811 142.435559 \n",
       "L 161.631251 142.344014 \n",
       "L 158.579684 142.246566 \n",
       "L 155.528125 142.143209 \n",
       "L 152.476565 142.033943 \n",
       "L 149.424998 141.918775 \n",
       "L 146.373439 141.797698 \n",
       "L 143.321872 141.670719 \n",
       "L 140.270312 141.537831 \n",
       "L 137.218753 141.399034 \n",
       "L 134.167186 141.254334 \n",
       "L 131.115627 141.103726 \n",
       "L 128.06406 140.947215 \n",
       "L 125.0125 140.784796 \n",
       "L 121.960941 140.616474 \n",
       "L 118.909374 140.442243 \n",
       "L 115.857814 140.262103 \n",
       "L 112.806247 140.076061 \n",
       "L 109.754688 139.88411 \n",
       "L 106.703128 139.686256 \n",
       "L 105.641795 139.615388 \n",
       "L 103.651562 139.477832 \n",
       "L 100.600002 139.26081 \n",
       "L 97.548443 139.037672 \n",
       "L 94.496876 138.80842 \n",
       "L 91.445309 138.573055 \n",
       "L 88.393749 138.331578 \n",
       "L 85.34219 138.083987 \n",
       "L 82.29063 137.830285 \n",
       "L 79.239056 137.570464 \n",
       "L 76.187497 137.304534 \n",
       "L 73.135937 137.032489 \n",
       "L 70.084378 136.754332 \n",
       "L 67.032818 136.47006 \n",
       "L 63.981244 136.179677 \n",
       "L 63.477871 136.130768 \n",
       "L 60.929684 135.874175 \n",
       "L 57.878125 135.560557 \n",
       "L 54.826565 135.240612 \n",
       "L 51.775006 134.914323 \n",
       "L 48.723432 134.581696 \n",
       "L 45.671872 134.242743 \n",
       "L 42.620312 133.897445 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "    <path d=\"M 237.920312 142.860804 \n",
       "L 234.868753 142.911006 \n",
       "L 231.817193 142.9553 \n",
       "L 228.765619 142.993692 \n",
       "L 225.71406 143.026175 \n",
       "L 222.6625 143.052749 \n",
       "L 219.610941 143.07342 \n",
       "L 216.559381 143.088189 \n",
       "L 213.507807 143.097049 \n",
       "L 210.456247 143.1 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_8\">\n",
       "    <path d=\"M 43.320206 143.1 \n",
       "L 42.620312 143.026175 \n",
       "\" clip-path=\"url(#pbd706e7771)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_9\"/>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 42.620312 143.1 \n",
       "L 42.620312 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 237.920313 143.1 \n",
       "L 237.920313 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 42.620312 143.1 \n",
       "L 237.920312 143.1 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 42.620312 7.2 \n",
       "L 237.920312 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pbd706e7771\">\n",
       "   <rect x=\"42.620312\" y=\"7.2\" width=\"195.3\" height=\"135.9\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 252x180 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import math\n",
    "import mindspore\n",
    "from d2l import mindspore as d2l\n",
    "\n",
    "def adagrad_2d(x1, x2, s1, s2):\n",
    "    eps = 1e-6\n",
    "    g1, g2 = 0.2 * x1, 4 * x2\n",
    "    s1 += g1 ** 2\n",
    "    s2 += g2 ** 2\n",
    "    x1 -= eta / math.sqrt(s1 + eps) * g1\n",
    "    x2 -= eta / math.sqrt(s2 + eps) * g2\n",
    "    return x1, x2, s1, s2\n",
    "\n",
    "def f_2d(x1, x2):\n",
    "    return 0.1 * x1 ** 2 + 2 * x2 ** 2\n",
    "\n",
    "eta = 0.4\n",
    "d2l.show_trace_2d(f_2d, d2l.train_2d(adagrad_2d))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5e31c1a1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "epoch 20, x1: -0.002295, x2: -0.000000\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"245.120313pt\" height=\"180.65625pt\" viewBox=\"0 0 245.120313 180.65625\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-03-03T02:14:33.781314</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.5.1, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M 0 180.65625 \n",
       "L 245.120313 180.65625 \n",
       "L 245.120313 0 \n",
       "L 0 0 \n",
       "L 0 180.65625 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 42.620312 143.1 \n",
       "L 237.920313 143.1 \n",
       "L 237.920313 7.2 \n",
       "L 42.620312 7.2 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <defs>\n",
       "       <path id=\"m1e0684f2ef\" d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m1e0684f2ef\" x=\"88.393749\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- −4 -->\n",
       "      <g transform=\"translate(81.022656 157.698438)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-2212\" d=\"M 678 2272 \n",
       "L 4684 2272 \n",
       "L 4684 1741 \n",
       "L 678 1741 \n",
       "L 678 2272 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
       "L 825 1625 \n",
       "L 2419 1625 \n",
       "L 2419 4116 \n",
       "z\n",
       "M 2253 4666 \n",
       "L 3047 4666 \n",
       "L 3047 1625 \n",
       "L 3713 1625 \n",
       "L 3713 1100 \n",
       "L 3047 1100 \n",
       "L 3047 0 \n",
       "L 2419 0 \n",
       "L 2419 1100 \n",
       "L 313 1100 \n",
       "L 313 1709 \n",
       "L 2253 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-34\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_2\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m1e0684f2ef\" x=\"149.424998\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- −2 -->\n",
       "      <g transform=\"translate(142.053905 157.698438)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m1e0684f2ef\" x=\"210.456247\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 0 -->\n",
       "      <g transform=\"translate(207.274997 157.698438)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_4\">\n",
       "     <!-- x1 -->\n",
       "     <g transform=\"translate(134.129687 171.376563)scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-78\" d=\"M 3513 3500 \n",
       "L 2247 1797 \n",
       "L 3578 0 \n",
       "L 2900 0 \n",
       "L 1881 1375 \n",
       "L 863 0 \n",
       "L 184 0 \n",
       "L 1544 1831 \n",
       "L 300 3500 \n",
       "L 978 3500 \n",
       "L 1906 2253 \n",
       "L 2834 3500 \n",
       "L 3513 3500 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-78\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-31\" x=\"59.179688\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_4\">\n",
       "      <defs>\n",
       "       <path id=\"m0537bddab9\" d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0537bddab9\" x=\"42.620312\" y=\"143.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- −3 -->\n",
       "      <g transform=\"translate(20.878125 146.899219)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \n",
       "Q 3050 2419 3304 2112 \n",
       "Q 3559 1806 3559 1356 \n",
       "Q 3559 666 3084 287 \n",
       "Q 2609 -91 1734 -91 \n",
       "Q 1441 -91 1130 -33 \n",
       "Q 819 25 488 141 \n",
       "L 488 750 \n",
       "Q 750 597 1062 519 \n",
       "Q 1375 441 1716 441 \n",
       "Q 2309 441 2620 675 \n",
       "Q 2931 909 2931 1356 \n",
       "Q 2931 1769 2642 2001 \n",
       "Q 2353 2234 1838 2234 \n",
       "L 1294 2234 \n",
       "L 1294 2753 \n",
       "L 1863 2753 \n",
       "Q 2328 2753 2575 2939 \n",
       "Q 2822 3125 2822 3475 \n",
       "Q 2822 3834 2567 4026 \n",
       "Q 2313 4219 1838 4219 \n",
       "Q 1578 4219 1281 4162 \n",
       "Q 984 4106 628 3988 \n",
       "L 628 4550 \n",
       "Q 988 4650 1302 4700 \n",
       "Q 1616 4750 1894 4750 \n",
       "Q 2613 4750 3031 4423 \n",
       "Q 3450 4097 3450 3541 \n",
       "Q 3450 3153 3228 2886 \n",
       "Q 3006 2619 2597 2516 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0537bddab9\" x=\"42.620312\" y=\"108.253847\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_6\">\n",
       "      <!-- −2 -->\n",
       "      <g transform=\"translate(20.878125 112.053066)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0537bddab9\" x=\"42.620312\" y=\"73.407694\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- −1 -->\n",
       "      <g transform=\"translate(20.878125 77.206913)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-2212\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-31\" x=\"83.789062\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m0537bddab9\" x=\"42.620312\" y=\"38.561541\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 0 -->\n",
       "      <g transform=\"translate(29.257812 42.36076)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_9\">\n",
       "     <!-- x2 -->\n",
       "     <g transform=\"translate(14.798437 81.290625)rotate(-90)scale(0.1 -0.1)\">\n",
       "      <use xlink:href=\"#DejaVuSans-78\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-32\" x=\"59.179688\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_8\">\n",
       "    <path d=\"M 57.878125 108.253847 \n",
       "L 118.909343 38.561542 \n",
       "L 150.309658 38.561541 \n",
       "L 169.853407 38.561541 \n",
       "L 182.748836 38.561541 \n",
       "L 191.458617 38.561541 \n",
       "L 197.402107 38.561541 \n",
       "L 201.477037 38.561541 \n",
       "L 204.277001 38.561541 \n",
       "L 206.2029 38.561541 \n",
       "L 207.528238 38.561541 \n",
       "L 208.4405 38.561541 \n",
       "L 209.068501 38.561541 \n",
       "L 209.500839 38.561541 \n",
       "L 209.798483 38.561541 \n",
       "L 210.003399 38.561541 \n",
       "L 210.144476 38.561541 \n",
       "L 210.241603 38.561541 \n",
       "L 210.308472 38.561541 \n",
       "L 210.354509 38.561541 \n",
       "L 210.386204 38.561541 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #ff7f0e; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "    <defs>\n",
       "     <path id=\"m8290917e4d\" d=\"M 0 3 \n",
       "C 0.795609 3 1.55874 2.683901 2.12132 2.12132 \n",
       "C 2.683901 1.55874 3 0.795609 3 0 \n",
       "C 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \n",
       "C 1.55874 -2.683901 0.795609 -3 0 -3 \n",
       "C -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \n",
       "C -2.683901 -1.55874 -3 -0.795609 -3 0 \n",
       "C -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \n",
       "C -1.55874 2.683901 -0.795609 3 0 3 \n",
       "z\n",
       "\" style=\"stroke: #ff7f0e\"/>\n",
       "    </defs>\n",
       "    <g clip-path=\"url(#pcd2cfaa0d0)\">\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"57.878125\" y=\"108.253847\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"118.909343\" y=\"38.561542\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"150.309658\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"169.853407\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"182.748836\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"191.458617\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"197.402107\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"201.477037\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"204.277001\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"206.2029\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"207.528238\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"208.4405\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"209.068501\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"209.500839\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"209.798483\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"210.003399\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"210.144476\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"210.241603\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"210.308472\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"210.354509\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "     <use xlink:href=\"#m8290917e4d\" x=\"210.386204\" y=\"38.561541\" style=\"fill: #ff7f0e; stroke: #ff7f0e\"/>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_1\">\n",
       "    <path d=\"M 210.456247 38.561541 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_2\">\n",
       "    <path d=\"M 237.920312 80.648724 \n",
       "L 234.868753 80.767201 \n",
       "L 231.817193 80.87174 \n",
       "L 228.765619 80.96234 \n",
       "L 225.71406 81.039001 \n",
       "L 222.6625 81.101725 \n",
       "L 219.610941 81.150509 \n",
       "L 216.559381 81.185356 \n",
       "L 213.507807 81.206264 \n",
       "L 210.456247 81.213233 \n",
       "L 207.404688 81.206264 \n",
       "L 204.353128 81.185356 \n",
       "L 201.301569 81.150509 \n",
       "L 198.249995 81.101725 \n",
       "L 195.198435 81.039001 \n",
       "L 192.146876 80.96234 \n",
       "L 189.095316 80.87174 \n",
       "L 186.043757 80.767202 \n",
       "L 182.992182 80.648724 \n",
       "L 179.940623 80.51631 \n",
       "L 177.03433 80.376922 \n",
       "L 176.889063 80.369349 \n",
       "L 173.837504 80.195118 \n",
       "L 170.785944 80.005738 \n",
       "L 167.73437 79.801205 \n",
       "L 164.682811 79.581524 \n",
       "L 161.631251 79.34669 \n",
       "L 158.579684 79.096707 \n",
       "L 155.528125 78.831575 \n",
       "L 152.476565 78.551289 \n",
       "L 149.424998 78.255854 \n",
       "L 146.373439 77.94527 \n",
       "L 143.321872 77.619534 \n",
       "L 140.270312 77.278647 \n",
       "L 137.218753 76.922611 \n",
       "L 136.969649 76.89231 \n",
       "L 134.167186 76.518958 \n",
       "L 131.115627 76.095827 \n",
       "L 128.06406 75.6561 \n",
       "L 125.0125 75.199783 \n",
       "L 121.960941 74.726871 \n",
       "L 118.909374 74.237364 \n",
       "L 115.857814 73.731266 \n",
       "L 113.968754 73.407694 \n",
       "L 112.806247 73.187612 \n",
       "L 109.754688 72.59156 \n",
       "L 106.703128 71.977167 \n",
       "L 103.651562 71.344435 \n",
       "L 100.600002 70.693362 \n",
       "L 97.548443 70.02395 \n",
       "L 97.100855 69.923074 \n",
       "L 94.496876 69.26715 \n",
       "L 91.445309 68.477985 \n",
       "L 88.393749 67.668327 \n",
       "L 85.34219 66.838168 \n",
       "L 83.908318 66.438462 \n",
       "L 82.29063 65.927389 \n",
       "L 79.239056 64.940075 \n",
       "L 76.187497 63.929538 \n",
       "L 73.307377 62.95385 \n",
       "L 73.135937 62.886836 \n",
       "L 70.084378 61.66722 \n",
       "L 67.032818 60.420802 \n",
       "L 64.752163 59.469229 \n",
       "L 63.981244 59.089091 \n",
       "L 60.929684 57.552694 \n",
       "L 57.878125 55.984618 \n",
       "L 54.826565 54.029365 \n",
       "L 52.486033 52.499997 \n",
       "L 51.775006 51.902647 \n",
       "L 48.723432 49.289169 \n",
       "L 48.409729 49.015385 \n",
       "L 45.671872 45.670156 \n",
       "L 45.55989 45.530773 \n",
       "L 43.880133 42.046153 \n",
       "L 43.320214 38.561541 \n",
       "L 43.880133 35.076921 \n",
       "L 45.55989 31.592309 \n",
       "L 45.671872 31.452926 \n",
       "L 48.409729 28.107697 \n",
       "L 48.723432 27.833913 \n",
       "L 51.775006 25.220438 \n",
       "L 52.486047 24.623076 \n",
       "L 54.826565 23.093718 \n",
       "L 57.878125 21.138465 \n",
       "L 60.929684 19.570388 \n",
       "L 63.981244 18.033991 \n",
       "L 64.752179 17.653844 \n",
       "L 67.032818 16.702279 \n",
       "L 70.084378 15.455861 \n",
       "L 73.135937 14.236246 \n",
       "L 73.307377 14.169232 \n",
       "L 76.187497 13.193544 \n",
       "L 79.239056 12.183007 \n",
       "L 82.29063 11.195693 \n",
       "L 83.908318 10.68462 \n",
       "L 85.34219 10.284914 \n",
       "L 88.393749 9.454754 \n",
       "L 91.445309 8.645096 \n",
       "L 94.496876 7.855932 \n",
       "L 97.100893 7.2 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_3\">\n",
       "    <path d=\"M 237.920312 98.491946 \n",
       "L 234.868753 98.576571 \n",
       "L 231.817193 98.651241 \n",
       "L 228.765619 98.715958 \n",
       "L 225.71406 98.770714 \n",
       "L 222.6625 98.815518 \n",
       "L 219.610941 98.850364 \n",
       "L 216.559381 98.875252 \n",
       "L 213.507807 98.890188 \n",
       "L 210.456247 98.895165 \n",
       "L 207.404688 98.890188 \n",
       "L 204.353128 98.875252 \n",
       "L 201.301569 98.850364 \n",
       "L 198.249995 98.815518 \n",
       "L 195.198435 98.770714 \n",
       "L 192.146876 98.715958 \n",
       "L 189.095316 98.651243 \n",
       "L 186.043757 98.576571 \n",
       "L 182.992182 98.491946 \n",
       "L 179.940623 98.397363 \n",
       "L 176.889063 98.292825 \n",
       "L 173.837504 98.17833 \n",
       "L 170.785944 98.053878 \n",
       "L 167.73437 97.919472 \n",
       "L 165.208907 97.799999 \n",
       "L 164.682811 97.773602 \n",
       "L 161.631251 97.60993 \n",
       "L 158.579684 97.435699 \n",
       "L 155.528125 97.25091 \n",
       "L 152.476565 97.055559 \n",
       "L 149.424998 96.84965 \n",
       "L 146.373439 96.633182 \n",
       "L 143.321872 96.406153 \n",
       "L 140.270312 96.168568 \n",
       "L 137.218753 95.920421 \n",
       "L 134.167186 95.661713 \n",
       "L 131.115627 95.392447 \n",
       "L 128.06406 95.112622 \n",
       "L 125.0125 94.822238 \n",
       "L 121.960941 94.521293 \n",
       "L 119.943827 94.315387 \n",
       "L 118.909374 94.202977 \n",
       "L 115.857814 93.860137 \n",
       "L 112.806247 93.506054 \n",
       "L 109.754688 93.140732 \n",
       "L 106.703128 92.764169 \n",
       "L 103.651562 92.376366 \n",
       "L 100.600002 91.977321 \n",
       "L 97.548443 91.567036 \n",
       "L 94.496876 91.145509 \n",
       "L 92.277554 90.830771 \n",
       "L 91.445309 90.704604 \n",
       "L 88.393749 90.229975 \n",
       "L 85.34219 89.743331 \n",
       "L 82.29063 89.244671 \n",
       "L 79.239056 88.733993 \n",
       "L 76.187497 88.211301 \n",
       "L 73.135937 87.676594 \n",
       "L 71.291579 87.346154 \n",
       "L 70.084378 87.113848 \n",
       "L 67.032818 86.51372 \n",
       "L 63.981244 85.900684 \n",
       "L 60.929684 85.274745 \n",
       "L 57.878125 84.635899 \n",
       "L 54.826565 83.984148 \n",
       "L 54.263641 83.861538 \n",
       "L 51.775006 83.276125 \n",
       "L 48.723432 82.544352 \n",
       "L 45.671872 81.798649 \n",
       "L 42.620312 81.039001 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_4\">\n",
       "    <path d=\"M 237.920312 112.139599 \n",
       "L 234.868753 112.208481 \n",
       "L 231.817193 112.269261 \n",
       "L 228.765619 112.321933 \n",
       "L 225.71406 112.366507 \n",
       "L 222.6625 112.402973 \n",
       "L 219.610941 112.431336 \n",
       "L 216.559381 112.451596 \n",
       "L 213.507807 112.463748 \n",
       "L 210.456247 112.467802 \n",
       "L 207.404688 112.463748 \n",
       "L 204.353128 112.451596 \n",
       "L 201.301569 112.431336 \n",
       "L 198.249995 112.402973 \n",
       "L 195.198435 112.366507 \n",
       "L 192.146876 112.321933 \n",
       "L 189.095316 112.269261 \n",
       "L 186.043757 112.208481 \n",
       "L 182.992182 112.139599 \n",
       "L 179.940623 112.062613 \n",
       "L 176.889063 111.977524 \n",
       "L 173.837504 111.884331 \n",
       "L 170.785944 111.783036 \n",
       "L 169.542551 111.738459 \n",
       "L 167.73437 111.670471 \n",
       "L 164.682811 111.547234 \n",
       "L 161.631251 111.415502 \n",
       "L 158.579684 111.275267 \n",
       "L 155.528125 111.12653 \n",
       "L 152.476565 110.969299 \n",
       "L 149.424998 110.803569 \n",
       "L 146.373439 110.629336 \n",
       "L 143.321872 110.446605 \n",
       "L 140.270312 110.255376 \n",
       "L 137.218753 110.055648 \n",
       "L 134.167186 109.847422 \n",
       "L 131.115627 109.630697 \n",
       "L 128.06406 109.40547 \n",
       "L 125.0125 109.171745 \n",
       "L 121.960941 108.929524 \n",
       "L 118.909374 108.678802 \n",
       "L 115.857814 108.419577 \n",
       "L 113.968762 108.253847 \n",
       "L 112.806247 108.146627 \n",
       "L 109.754688 107.856244 \n",
       "L 106.703128 107.556924 \n",
       "L 103.651562 107.248668 \n",
       "L 100.600002 106.931482 \n",
       "L 97.548443 106.605357 \n",
       "L 94.496876 106.270297 \n",
       "L 91.445309 105.926302 \n",
       "L 88.393749 105.573374 \n",
       "L 85.34219 105.211509 \n",
       "L 82.29063 104.840713 \n",
       "L 81.716196 104.769231 \n",
       "L 79.239056 104.444313 \n",
       "L 76.187497 104.034636 \n",
       "L 73.135937 103.615542 \n",
       "L 70.084378 103.187029 \n",
       "L 67.032818 102.749098 \n",
       "L 63.981244 102.301748 \n",
       "L 60.929684 101.84498 \n",
       "L 57.878125 101.378796 \n",
       "L 57.273841 101.284615 \n",
       "L 54.826565 100.881398 \n",
       "L 51.775006 100.368663 \n",
       "L 48.723432 99.845968 \n",
       "L 45.671872 99.313318 \n",
       "L 42.620312 98.770713 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_5\">\n",
       "    <path d=\"M 237.920312 123.611044 \n",
       "L 234.868753 123.671492 \n",
       "L 231.817193 123.724829 \n",
       "L 228.765619 123.771052 \n",
       "L 225.71406 123.810168 \n",
       "L 222.6625 123.842169 \n",
       "L 219.610941 123.867058 \n",
       "L 216.559381 123.884838 \n",
       "L 213.507807 123.895502 \n",
       "L 210.456247 123.899059 \n",
       "L 207.404688 123.895502 \n",
       "L 204.353128 123.884838 \n",
       "L 201.301569 123.867058 \n",
       "L 198.249995 123.842169 \n",
       "L 195.198435 123.810168 \n",
       "L 192.146876 123.771052 \n",
       "L 189.095316 123.724829 \n",
       "L 186.043757 123.671492 \n",
       "L 182.992182 123.611044 \n",
       "L 179.940623 123.543485 \n",
       "L 176.889063 123.468815 \n",
       "L 173.837504 123.387034 \n",
       "L 170.785944 123.298143 \n",
       "L 167.73437 123.202136 \n",
       "L 164.682811 123.099019 \n",
       "L 161.631251 122.988795 \n",
       "L 158.579684 122.871456 \n",
       "L 155.528125 122.747002 \n",
       "L 152.476565 122.615441 \n",
       "L 149.424998 122.47677 \n",
       "L 146.373439 122.330983 \n",
       "L 143.605784 122.192312 \n",
       "L 143.321872 122.177481 \n",
       "L 140.270312 122.010664 \n",
       "L 137.218753 121.836433 \n",
       "L 134.167186 121.654789 \n",
       "L 131.115627 121.465731 \n",
       "L 128.06406 121.269256 \n",
       "L 125.0125 121.065368 \n",
       "L 121.960941 120.85407 \n",
       "L 118.909374 120.635354 \n",
       "L 115.857814 120.409222 \n",
       "L 112.806247 120.175679 \n",
       "L 109.754688 119.934723 \n",
       "L 106.703128 119.68635 \n",
       "L 103.651562 119.430563 \n",
       "L 100.600002 119.167366 \n",
       "L 97.548443 118.896753 \n",
       "L 95.473374 118.707691 \n",
       "L 94.496876 118.614768 \n",
       "L 91.445309 118.316641 \n",
       "L 88.393749 118.010767 \n",
       "L 85.34219 117.697155 \n",
       "L 82.29063 117.375795 \n",
       "L 79.239056 117.046693 \n",
       "L 76.187497 116.709847 \n",
       "L 73.135937 116.365258 \n",
       "L 70.084378 116.012923 \n",
       "L 67.032818 115.652848 \n",
       "L 63.981244 115.285027 \n",
       "L 63.477901 115.223079 \n",
       "L 60.929684 114.894876 \n",
       "L 57.878125 114.49374 \n",
       "L 54.826565 114.084501 \n",
       "L 51.775006 113.667159 \n",
       "L 48.723432 113.24171 \n",
       "L 45.671872 112.808158 \n",
       "L 42.620312 112.366503 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_6\">\n",
       "    <path d=\"M 237.920312 133.720047 \n",
       "L 234.868753 133.773901 \n",
       "L 231.817193 133.82142 \n",
       "L 228.765619 133.8626 \n",
       "L 225.71406 133.897448 \n",
       "L 222.6625 133.925958 \n",
       "L 219.610941 133.948133 \n",
       "L 216.559381 133.963973 \n",
       "L 213.507807 133.973474 \n",
       "L 210.456247 133.976643 \n",
       "L 207.404688 133.973474 \n",
       "L 204.353128 133.963973 \n",
       "L 201.301569 133.948133 \n",
       "L 198.249995 133.925958 \n",
       "L 195.198435 133.897448 \n",
       "L 192.146876 133.8626 \n",
       "L 189.095316 133.82142 \n",
       "L 186.043757 133.773901 \n",
       "L 182.992182 133.720047 \n",
       "L 179.940623 133.659858 \n",
       "L 176.889063 133.593334 \n",
       "L 173.837504 133.520475 \n",
       "L 170.785944 133.44128 \n",
       "L 167.73437 133.355747 \n",
       "L 164.682811 133.263879 \n",
       "L 161.631251 133.165679 \n",
       "L 158.579684 133.061141 \n",
       "L 155.528125 132.950264 \n",
       "L 152.476565 132.833055 \n",
       "L 149.424998 132.709511 \n",
       "L 147.936483 132.646156 \n",
       "L 146.373439 132.577118 \n",
       "L 143.321872 132.43576 \n",
       "L 140.270312 132.287829 \n",
       "L 137.218753 132.133322 \n",
       "L 134.167186 131.972242 \n",
       "L 131.115627 131.804587 \n",
       "L 128.06406 131.630355 \n",
       "L 125.0125 131.449549 \n",
       "L 121.960941 131.262171 \n",
       "L 118.909374 131.068216 \n",
       "L 115.857814 130.867686 \n",
       "L 112.806247 130.660581 \n",
       "L 109.754688 130.446903 \n",
       "L 106.703128 130.226648 \n",
       "L 103.651562 129.999818 \n",
       "L 100.600002 129.766418 \n",
       "L 97.548443 129.52644 \n",
       "L 94.496876 129.279885 \n",
       "L 93.070115 129.161535 \n",
       "L 91.445309 129.021473 \n",
       "L 88.393749 128.751584 \n",
       "L 85.34219 128.474867 \n",
       "L 82.29063 128.191314 \n",
       "L 79.239056 127.900929 \n",
       "L 76.187497 127.603712 \n",
       "L 73.135937 127.299663 \n",
       "L 70.084378 126.988779 \n",
       "L 67.032818 126.671065 \n",
       "L 63.981244 126.346517 \n",
       "L 60.929684 126.015136 \n",
       "L 57.878125 125.676924 \n",
       "L 54.826565 125.317796 \n",
       "L 51.775006 124.951557 \n",
       "L 48.723432 124.578203 \n",
       "L 45.671872 124.197739 \n",
       "L 42.620312 123.810168 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_7\">\n",
       "    <path d=\"M 210.456247 143.1 \n",
       "L 207.404688 143.097049 \n",
       "L 204.353128 143.088189 \n",
       "L 201.301569 143.07342 \n",
       "L 198.249995 143.052749 \n",
       "L 195.198435 143.026175 \n",
       "L 192.146876 142.993692 \n",
       "L 189.095316 142.9553 \n",
       "L 186.043757 142.911006 \n",
       "L 182.992182 142.860804 \n",
       "L 179.940623 142.804692 \n",
       "L 176.889063 142.742678 \n",
       "L 173.837504 142.674761 \n",
       "L 170.785944 142.60093 \n",
       "L 167.73437 142.521202 \n",
       "L 164.682811 142.435559 \n",
       "L 161.631251 142.344014 \n",
       "L 158.579684 142.246566 \n",
       "L 155.528125 142.143209 \n",
       "L 152.476565 142.033943 \n",
       "L 149.424998 141.918775 \n",
       "L 146.373439 141.797698 \n",
       "L 143.321872 141.670719 \n",
       "L 140.270312 141.537831 \n",
       "L 137.218753 141.399034 \n",
       "L 134.167186 141.254334 \n",
       "L 131.115627 141.103726 \n",
       "L 128.06406 140.947215 \n",
       "L 125.0125 140.784796 \n",
       "L 121.960941 140.616474 \n",
       "L 118.909374 140.442243 \n",
       "L 115.857814 140.262103 \n",
       "L 112.806247 140.076061 \n",
       "L 109.754688 139.88411 \n",
       "L 106.703128 139.686256 \n",
       "L 105.641795 139.615388 \n",
       "L 103.651562 139.477832 \n",
       "L 100.600002 139.26081 \n",
       "L 97.548443 139.037672 \n",
       "L 94.496876 138.80842 \n",
       "L 91.445309 138.573055 \n",
       "L 88.393749 138.331578 \n",
       "L 85.34219 138.083987 \n",
       "L 82.29063 137.830285 \n",
       "L 79.239056 137.570464 \n",
       "L 76.187497 137.304534 \n",
       "L 73.135937 137.032489 \n",
       "L 70.084378 136.754332 \n",
       "L 67.032818 136.47006 \n",
       "L 63.981244 136.179677 \n",
       "L 63.477871 136.130768 \n",
       "L 60.929684 135.874175 \n",
       "L 57.878125 135.560557 \n",
       "L 54.826565 135.240612 \n",
       "L 51.775006 134.914323 \n",
       "L 48.723432 134.581696 \n",
       "L 45.671872 134.242743 \n",
       "L 42.620312 133.897445 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "    <path d=\"M 237.920312 142.860804 \n",
       "L 234.868753 142.911006 \n",
       "L 231.817193 142.9553 \n",
       "L 228.765619 142.993692 \n",
       "L 225.71406 143.026175 \n",
       "L 222.6625 143.052749 \n",
       "L 219.610941 143.07342 \n",
       "L 216.559381 143.088189 \n",
       "L 213.507807 143.097049 \n",
       "L 210.456247 143.1 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_8\">\n",
       "    <path d=\"M 43.320206 143.1 \n",
       "L 42.620312 143.026175 \n",
       "\" clip-path=\"url(#pcd2cfaa0d0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5\"/>\n",
       "   </g>\n",
       "   <g id=\"PathCollection_9\"/>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 42.620312 143.1 \n",
       "L 42.620312 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 237.920313 143.1 \n",
       "L 237.920313 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 42.620312 143.1 \n",
       "L 237.920312 143.1 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 42.620312 7.2 \n",
       "L 237.920312 7.2 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pcd2cfaa0d0\">\n",
       "   <rect x=\"42.620312\" y=\"7.2\" width=\"195.3\" height=\"135.9\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 252x180 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "eta = 2\n",
    "d2l.show_trace_2d(f_2d, d2l.train_2d(adagrad_2d))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "427d24ae",
   "metadata": {},
   "source": [
    "### 11.7.4. 从零开始实现"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "397ffedb",
   "metadata": {},
   "outputs": [],
   "source": [
    "def init_adagrad_states(feature_dim):\n",
    "    s_w = d2l.zeros((feature_dim, 1))\n",
    "    s_b = d2l.zeros(1)\n",
    "    return (s_w, s_b)\n",
    "\n",
    "def adagrad(params, grads, states, hyperparams):\n",
    "    eps = 1e-6\n",
    "    for p, s, g in zip(params, states, grads):\n",
    "        s[:] += d2l.square(g)\n",
    "        p[:] -= hyperparams['lr'] * g / d2l.sqrt(s + eps)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "ef044f0b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loss: 0.242, 0.430 sec/epoch\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"266.957813pt\" height=\"184.455469pt\" viewBox=\"0 0 266.957813 184.455469\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-03-03T02:14:44.737063</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.5.1, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M -0 184.455469 \n",
       "L 266.957813 184.455469 \n",
       "L 266.957813 0 \n",
       "L -0 0 \n",
       "L -0 184.455469 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 56.50625 146.899219 \n",
       "L 251.80625 146.899219 \n",
       "L 251.80625 10.999219 \n",
       "L 56.50625 10.999219 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 56.50625 146.899219 \n",
       "L 56.50625 10.999219 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\">\n",
       "      <defs>\n",
       "       <path id=\"mcdeb7bb89c\" d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mcdeb7bb89c\" x=\"56.50625\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- 0.0 -->\n",
       "      <g transform=\"translate(48.554688 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
       "L 1344 794 \n",
       "L 1344 0 \n",
       "L 684 0 \n",
       "L 684 794 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 105.33125 146.899219 \n",
       "L 105.33125 10.999219 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mcdeb7bb89c\" x=\"105.33125\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- 0.5 -->\n",
       "      <g transform=\"translate(97.379688 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-35\" d=\"M 691 4666 \n",
       "L 3169 4666 \n",
       "L 3169 4134 \n",
       "L 1269 4134 \n",
       "L 1269 2991 \n",
       "Q 1406 3038 1543 3061 \n",
       "Q 1681 3084 1819 3084 \n",
       "Q 2600 3084 3056 2656 \n",
       "Q 3513 2228 3513 1497 \n",
       "Q 3513 744 3044 326 \n",
       "Q 2575 -91 1722 -91 \n",
       "Q 1428 -91 1123 -41 \n",
       "Q 819 9 494 109 \n",
       "L 494 744 \n",
       "Q 775 591 1075 516 \n",
       "Q 1375 441 1709 441 \n",
       "Q 2250 441 2565 725 \n",
       "Q 2881 1009 2881 1497 \n",
       "Q 2881 1984 2565 2268 \n",
       "Q 2250 2553 1709 2553 \n",
       "Q 1456 2553 1204 2497 \n",
       "Q 953 2441 691 2322 \n",
       "L 691 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 154.15625 146.899219 \n",
       "L 154.15625 10.999219 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mcdeb7bb89c\" x=\"154.15625\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 1.0 -->\n",
       "      <g transform=\"translate(146.204688 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 202.98125 146.899219 \n",
       "L 202.98125 10.999219 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mcdeb7bb89c\" x=\"202.98125\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- 1.5 -->\n",
       "      <g transform=\"translate(195.029688 161.497656)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 251.80625 146.899219 \n",
       "L 251.80625 10.999219 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mcdeb7bb89c\" x=\"251.80625\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- 2.0 -->\n",
       "      <g transform=\"translate(243.854688 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-32\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"95.410156\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_6\">\n",
       "     <!-- epoch -->\n",
       "     <g transform=\"translate(138.928125 175.175781)scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \n",
       "L 3597 1613 \n",
       "L 953 1613 \n",
       "Q 991 1019 1311 708 \n",
       "Q 1631 397 2203 397 \n",
       "Q 2534 397 2845 478 \n",
       "Q 3156 559 3463 722 \n",
       "L 3463 178 \n",
       "Q 3153 47 2828 -22 \n",
       "Q 2503 -91 2169 -91 \n",
       "Q 1331 -91 842 396 \n",
       "Q 353 884 353 1716 \n",
       "Q 353 2575 817 3079 \n",
       "Q 1281 3584 2069 3584 \n",
       "Q 2775 3584 3186 3129 \n",
       "Q 3597 2675 3597 1894 \n",
       "z\n",
       "M 3022 2063 \n",
       "Q 3016 2534 2758 2815 \n",
       "Q 2500 3097 2075 3097 \n",
       "Q 1594 3097 1305 2825 \n",
       "Q 1016 2553 972 2059 \n",
       "L 3022 2063 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \n",
       "L 1159 -1331 \n",
       "L 581 -1331 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2969 \n",
       "Q 1341 3281 1617 3432 \n",
       "Q 1894 3584 2278 3584 \n",
       "Q 2916 3584 3314 3078 \n",
       "Q 3713 2572 3713 1747 \n",
       "Q 3713 922 3314 415 \n",
       "Q 2916 -91 2278 -91 \n",
       "Q 1894 -91 1617 61 \n",
       "Q 1341 213 1159 525 \n",
       "z\n",
       "M 3116 1747 \n",
       "Q 3116 2381 2855 2742 \n",
       "Q 2594 3103 2138 3103 \n",
       "Q 1681 3103 1420 2742 \n",
       "Q 1159 2381 1159 1747 \n",
       "Q 1159 1113 1420 752 \n",
       "Q 1681 391 2138 391 \n",
       "Q 2594 391 2855 752 \n",
       "Q 3116 1113 3116 1747 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \n",
       "Q 1497 3097 1228 2736 \n",
       "Q 959 2375 959 1747 \n",
       "Q 959 1119 1226 758 \n",
       "Q 1494 397 1959 397 \n",
       "Q 2419 397 2687 759 \n",
       "Q 2956 1122 2956 1747 \n",
       "Q 2956 2369 2687 2733 \n",
       "Q 2419 3097 1959 3097 \n",
       "z\n",
       "M 1959 3584 \n",
       "Q 2709 3584 3137 3096 \n",
       "Q 3566 2609 3566 1747 \n",
       "Q 3566 888 3137 398 \n",
       "Q 2709 -91 1959 -91 \n",
       "Q 1206 -91 779 398 \n",
       "Q 353 888 353 1747 \n",
       "Q 353 2609 779 3096 \n",
       "Q 1206 3584 1959 3584 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \n",
       "L 3122 2828 \n",
       "Q 2878 2963 2633 3030 \n",
       "Q 2388 3097 2138 3097 \n",
       "Q 1578 3097 1268 2742 \n",
       "Q 959 2388 959 1747 \n",
       "Q 959 1106 1268 751 \n",
       "Q 1578 397 2138 397 \n",
       "Q 2388 397 2633 464 \n",
       "Q 2878 531 3122 666 \n",
       "L 3122 134 \n",
       "Q 2881 22 2623 -34 \n",
       "Q 2366 -91 2075 -91 \n",
       "Q 1284 -91 818 406 \n",
       "Q 353 903 353 1747 \n",
       "Q 353 2603 823 3093 \n",
       "Q 1294 3584 2113 3584 \n",
       "Q 2378 3584 2631 3529 \n",
       "Q 2884 3475 3122 3366 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \n",
       "L 3513 0 \n",
       "L 2938 0 \n",
       "L 2938 2094 \n",
       "Q 2938 2591 2744 2837 \n",
       "Q 2550 3084 2163 3084 \n",
       "Q 1697 3084 1428 2787 \n",
       "Q 1159 2491 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 4863 \n",
       "L 1159 4863 \n",
       "L 1159 2956 \n",
       "Q 1366 3272 1645 3428 \n",
       "Q 1925 3584 2291 3584 \n",
       "Q 2894 3584 3203 3211 \n",
       "Q 3513 2838 3513 2113 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-65\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-70\" x=\"61.523438\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"125\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-63\" x=\"186.181641\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-68\" x=\"241.162109\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 56.50625 141.672296 \n",
       "L 251.80625 141.672296 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <defs>\n",
       "       <path id=\"m654a8ccaad\" d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m654a8ccaad\" x=\"56.50625\" y=\"141.672296\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- 0.225 -->\n",
       "      <g transform=\"translate(20.878125 145.471514)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 56.50625 115.53768 \n",
       "L 251.80625 115.53768 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m654a8ccaad\" x=\"56.50625\" y=\"115.53768\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 0.250 -->\n",
       "      <g transform=\"translate(20.878125 119.336899)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 56.50625 89.403065 \n",
       "L 251.80625 89.403065 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m654a8ccaad\" x=\"56.50625\" y=\"89.403065\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- 0.275 -->\n",
       "      <g transform=\"translate(20.878125 93.202284)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-37\" d=\"M 525 4666 \n",
       "L 3525 4666 \n",
       "L 3525 4397 \n",
       "L 1831 0 \n",
       "L 1172 0 \n",
       "L 2766 4134 \n",
       "L 525 4134 \n",
       "L 525 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-37\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 56.50625 63.26845 \n",
       "L 251.80625 63.26845 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m654a8ccaad\" x=\"56.50625\" y=\"63.26845\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- 0.300 -->\n",
       "      <g transform=\"translate(20.878125 67.067668)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \n",
       "Q 3050 2419 3304 2112 \n",
       "Q 3559 1806 3559 1356 \n",
       "Q 3559 666 3084 287 \n",
       "Q 2609 -91 1734 -91 \n",
       "Q 1441 -91 1130 -33 \n",
       "Q 819 25 488 141 \n",
       "L 488 750 \n",
       "Q 750 597 1062 519 \n",
       "Q 1375 441 1716 441 \n",
       "Q 2309 441 2620 675 \n",
       "Q 2931 909 2931 1356 \n",
       "Q 2931 1769 2642 2001 \n",
       "Q 2353 2234 1838 2234 \n",
       "L 1294 2234 \n",
       "L 1294 2753 \n",
       "L 1863 2753 \n",
       "Q 2328 2753 2575 2939 \n",
       "Q 2822 3125 2822 3475 \n",
       "Q 2822 3834 2567 4026 \n",
       "Q 2313 4219 1838 4219 \n",
       "Q 1578 4219 1281 4162 \n",
       "Q 984 4106 628 3988 \n",
       "L 628 4550 \n",
       "Q 988 4650 1302 4700 \n",
       "Q 1616 4750 1894 4750 \n",
       "Q 2613 4750 3031 4423 \n",
       "Q 3450 4097 3450 3541 \n",
       "Q 3450 3153 3228 2886 \n",
       "Q 3006 2619 2597 2516 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <path d=\"M 56.50625 37.133834 \n",
       "L 251.80625 37.133834 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m654a8ccaad\" x=\"56.50625\" y=\"37.133834\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- 0.325 -->\n",
       "      <g transform=\"translate(20.878125 40.933053)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <path d=\"M 56.50625 10.999219 \n",
       "L 251.80625 10.999219 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m654a8ccaad\" x=\"56.50625\" y=\"10.999219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- 0.350 -->\n",
       "      <g transform=\"translate(20.878125 14.798437)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_13\">\n",
       "     <!-- loss -->\n",
       "     <g transform=\"translate(14.798438 88.607031)rotate(-90)scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \n",
       "L 1178 4863 \n",
       "L 1178 0 \n",
       "L 603 0 \n",
       "L 603 4863 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \n",
       "L 2834 2853 \n",
       "Q 2591 2978 2328 3040 \n",
       "Q 2066 3103 1784 3103 \n",
       "Q 1356 3103 1142 2972 \n",
       "Q 928 2841 928 2578 \n",
       "Q 928 2378 1081 2264 \n",
       "Q 1234 2150 1697 2047 \n",
       "L 1894 2003 \n",
       "Q 2506 1872 2764 1633 \n",
       "Q 3022 1394 3022 966 \n",
       "Q 3022 478 2636 193 \n",
       "Q 2250 -91 1575 -91 \n",
       "Q 1294 -91 989 -36 \n",
       "Q 684 19 347 128 \n",
       "L 347 722 \n",
       "Q 666 556 975 473 \n",
       "Q 1284 391 1588 391 \n",
       "Q 1994 391 2212 530 \n",
       "Q 2431 669 2431 922 \n",
       "Q 2431 1156 2273 1281 \n",
       "Q 2116 1406 1581 1522 \n",
       "L 1381 1569 \n",
       "Q 847 1681 609 1914 \n",
       "Q 372 2147 372 2553 \n",
       "Q 372 3047 722 3315 \n",
       "Q 1072 3584 1716 3584 \n",
       "Q 2034 3584 2315 3537 \n",
       "Q 2597 3491 2834 3397 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-6c\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"27.783203\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-73\" x=\"88.964844\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-73\" x=\"141.064453\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_23\">\n",
       "    <path d=\"M 69.52625 80.175619 \n",
       "L 82.54625 111.867649 \n",
       "L 95.56625 116.515355 \n",
       "L 108.58625 118.888482 \n",
       "L 121.60625 121.048656 \n",
       "L 134.62625 120.990137 \n",
       "L 147.64625 120.945134 \n",
       "L 160.66625 123.35004 \n",
       "L 173.68625 120.882471 \n",
       "L 186.70625 123.313098 \n",
       "L 199.72625 123.544978 \n",
       "L 212.74625 121.195046 \n",
       "L 225.76625 123.631237 \n",
       "L 238.78625 121.561076 \n",
       "L 251.80625 123.7977 \n",
       "\" clip-path=\"url(#p4f58ea2c20)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 56.50625 146.899219 \n",
       "L 56.50625 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 251.80625 146.899219 \n",
       "L 251.80625 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 56.50625 146.899219 \n",
       "L 251.80625 146.899219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 56.50625 10.999219 \n",
       "L 251.80625 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"p4f58ea2c20\">\n",
       "   <rect x=\"56.50625\" y=\"10.999219\" width=\"195.3\" height=\"135.9\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 252x180 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "data_iter, feature_dim = d2l.get_data_ch11(batch_size=10)\n",
    "d2l.train_ch11(adagrad, init_adagrad_states(feature_dim),\n",
    "               {'lr': 0.1}, data_iter, feature_dim);"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "688e2c61",
   "metadata": {},
   "source": [
    "### 11.7.5. 简洁实现"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d54c38bb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loss: 0.243, 0.062 sec/epoch\n"
     ]
    },
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
       "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
       "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"262.1875pt\" height=\"184.455469pt\" viewBox=\"0 0 262.1875 184.455469\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n",
       " <metadata>\n",
       "  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n",
       "   <cc:Work>\n",
       "    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n",
       "    <dc:date>2023-03-03T02:14:56.156883</dc:date>\n",
       "    <dc:format>image/svg+xml</dc:format>\n",
       "    <dc:creator>\n",
       "     <cc:Agent>\n",
       "      <dc:title>Matplotlib v3.5.1, https://matplotlib.org/</dc:title>\n",
       "     </cc:Agent>\n",
       "    </dc:creator>\n",
       "   </cc:Work>\n",
       "  </rdf:RDF>\n",
       " </metadata>\n",
       " <defs>\n",
       "  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n",
       " </defs>\n",
       " <g id=\"figure_1\">\n",
       "  <g id=\"patch_1\">\n",
       "   <path d=\"M -0 184.455469 \n",
       "L 262.1875 184.455469 \n",
       "L 262.1875 0 \n",
       "L -0 0 \n",
       "L -0 184.455469 \n",
       "z\n",
       "\" style=\"fill: none\"/>\n",
       "  </g>\n",
       "  <g id=\"axes_1\">\n",
       "   <g id=\"patch_2\">\n",
       "    <path d=\"M 56.50625 146.899219 \n",
       "L 251.80625 146.899219 \n",
       "L 251.80625 10.999219 \n",
       "L 56.50625 10.999219 \n",
       "z\n",
       "\" style=\"fill: #ffffff\"/>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_1\">\n",
       "    <g id=\"xtick_1\">\n",
       "     <g id=\"line2d_1\">\n",
       "      <path d=\"M 56.50625 146.899219 \n",
       "L 56.50625 10.999219 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_2\">\n",
       "      <defs>\n",
       "       <path id=\"m417477f497\" d=\"M 0 0 \n",
       "L 0 3.5 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#m417477f497\" x=\"56.50625\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_1\">\n",
       "      <!-- 0 -->\n",
       "      <g transform=\"translate(53.325 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-30\" d=\"M 2034 4250 \n",
       "Q 1547 4250 1301 3770 \n",
       "Q 1056 3291 1056 2328 \n",
       "Q 1056 1369 1301 889 \n",
       "Q 1547 409 2034 409 \n",
       "Q 2525 409 2770 889 \n",
       "Q 3016 1369 3016 2328 \n",
       "Q 3016 3291 2770 3770 \n",
       "Q 2525 4250 2034 4250 \n",
       "z\n",
       "M 2034 4750 \n",
       "Q 2819 4750 3233 4129 \n",
       "Q 3647 3509 3647 2328 \n",
       "Q 3647 1150 3233 529 \n",
       "Q 2819 -91 2034 -91 \n",
       "Q 1250 -91 836 529 \n",
       "Q 422 1150 422 2328 \n",
       "Q 422 3509 836 4129 \n",
       "Q 1250 4750 2034 4750 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_2\">\n",
       "     <g id=\"line2d_3\">\n",
       "      <path d=\"M 105.33125 146.899219 \n",
       "L 105.33125 10.999219 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_4\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m417477f497\" x=\"105.33125\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_2\">\n",
       "      <!-- 1 -->\n",
       "      <g transform=\"translate(102.15 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-31\" d=\"M 794 531 \n",
       "L 1825 531 \n",
       "L 1825 4091 \n",
       "L 703 3866 \n",
       "L 703 4441 \n",
       "L 1819 4666 \n",
       "L 2450 4666 \n",
       "L 2450 531 \n",
       "L 3481 531 \n",
       "L 3481 0 \n",
       "L 794 0 \n",
       "L 794 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-31\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_3\">\n",
       "     <g id=\"line2d_5\">\n",
       "      <path d=\"M 154.15625 146.899219 \n",
       "L 154.15625 10.999219 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_6\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m417477f497\" x=\"154.15625\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_3\">\n",
       "      <!-- 2 -->\n",
       "      <g transform=\"translate(150.975 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-32\" d=\"M 1228 531 \n",
       "L 3431 531 \n",
       "L 3431 0 \n",
       "L 469 0 \n",
       "L 469 531 \n",
       "Q 828 903 1448 1529 \n",
       "Q 2069 2156 2228 2338 \n",
       "Q 2531 2678 2651 2914 \n",
       "Q 2772 3150 2772 3378 \n",
       "Q 2772 3750 2511 3984 \n",
       "Q 2250 4219 1831 4219 \n",
       "Q 1534 4219 1204 4116 \n",
       "Q 875 4013 500 3803 \n",
       "L 500 4441 \n",
       "Q 881 4594 1212 4672 \n",
       "Q 1544 4750 1819 4750 \n",
       "Q 2544 4750 2975 4387 \n",
       "Q 3406 4025 3406 3419 \n",
       "Q 3406 3131 3298 2873 \n",
       "Q 3191 2616 2906 2266 \n",
       "Q 2828 2175 2409 1742 \n",
       "Q 1991 1309 1228 531 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-32\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_4\">\n",
       "     <g id=\"line2d_7\">\n",
       "      <path d=\"M 202.98125 146.899219 \n",
       "L 202.98125 10.999219 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_8\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m417477f497\" x=\"202.98125\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_4\">\n",
       "      <!-- 3 -->\n",
       "      <g transform=\"translate(199.8 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-33\" d=\"M 2597 2516 \n",
       "Q 3050 2419 3304 2112 \n",
       "Q 3559 1806 3559 1356 \n",
       "Q 3559 666 3084 287 \n",
       "Q 2609 -91 1734 -91 \n",
       "Q 1441 -91 1130 -33 \n",
       "Q 819 25 488 141 \n",
       "L 488 750 \n",
       "Q 750 597 1062 519 \n",
       "Q 1375 441 1716 441 \n",
       "Q 2309 441 2620 675 \n",
       "Q 2931 909 2931 1356 \n",
       "Q 2931 1769 2642 2001 \n",
       "Q 2353 2234 1838 2234 \n",
       "L 1294 2234 \n",
       "L 1294 2753 \n",
       "L 1863 2753 \n",
       "Q 2328 2753 2575 2939 \n",
       "Q 2822 3125 2822 3475 \n",
       "Q 2822 3834 2567 4026 \n",
       "Q 2313 4219 1838 4219 \n",
       "Q 1578 4219 1281 4162 \n",
       "Q 984 4106 628 3988 \n",
       "L 628 4550 \n",
       "Q 988 4650 1302 4700 \n",
       "Q 1616 4750 1894 4750 \n",
       "Q 2613 4750 3031 4423 \n",
       "Q 3450 4097 3450 3541 \n",
       "Q 3450 3153 3228 2886 \n",
       "Q 3006 2619 2597 2516 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-33\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"xtick_5\">\n",
       "     <g id=\"line2d_9\">\n",
       "      <path d=\"M 251.80625 146.899219 \n",
       "L 251.80625 10.999219 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_10\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#m417477f497\" x=\"251.80625\" y=\"146.899219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_5\">\n",
       "      <!-- 4 -->\n",
       "      <g transform=\"translate(248.625 161.497656)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-34\" d=\"M 2419 4116 \n",
       "L 825 1625 \n",
       "L 2419 1625 \n",
       "L 2419 4116 \n",
       "z\n",
       "M 2253 4666 \n",
       "L 3047 4666 \n",
       "L 3047 1625 \n",
       "L 3713 1625 \n",
       "L 3713 1100 \n",
       "L 3047 1100 \n",
       "L 3047 0 \n",
       "L 2419 0 \n",
       "L 2419 1100 \n",
       "L 313 1100 \n",
       "L 313 1709 \n",
       "L 2253 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-34\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_6\">\n",
       "     <!-- epoch -->\n",
       "     <g transform=\"translate(138.928125 175.175781)scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-65\" d=\"M 3597 1894 \n",
       "L 3597 1613 \n",
       "L 953 1613 \n",
       "Q 991 1019 1311 708 \n",
       "Q 1631 397 2203 397 \n",
       "Q 2534 397 2845 478 \n",
       "Q 3156 559 3463 722 \n",
       "L 3463 178 \n",
       "Q 3153 47 2828 -22 \n",
       "Q 2503 -91 2169 -91 \n",
       "Q 1331 -91 842 396 \n",
       "Q 353 884 353 1716 \n",
       "Q 353 2575 817 3079 \n",
       "Q 1281 3584 2069 3584 \n",
       "Q 2775 3584 3186 3129 \n",
       "Q 3597 2675 3597 1894 \n",
       "z\n",
       "M 3022 2063 \n",
       "Q 3016 2534 2758 2815 \n",
       "Q 2500 3097 2075 3097 \n",
       "Q 1594 3097 1305 2825 \n",
       "Q 1016 2553 972 2059 \n",
       "L 3022 2063 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-70\" d=\"M 1159 525 \n",
       "L 1159 -1331 \n",
       "L 581 -1331 \n",
       "L 581 3500 \n",
       "L 1159 3500 \n",
       "L 1159 2969 \n",
       "Q 1341 3281 1617 3432 \n",
       "Q 1894 3584 2278 3584 \n",
       "Q 2916 3584 3314 3078 \n",
       "Q 3713 2572 3713 1747 \n",
       "Q 3713 922 3314 415 \n",
       "Q 2916 -91 2278 -91 \n",
       "Q 1894 -91 1617 61 \n",
       "Q 1341 213 1159 525 \n",
       "z\n",
       "M 3116 1747 \n",
       "Q 3116 2381 2855 2742 \n",
       "Q 2594 3103 2138 3103 \n",
       "Q 1681 3103 1420 2742 \n",
       "Q 1159 2381 1159 1747 \n",
       "Q 1159 1113 1420 752 \n",
       "Q 1681 391 2138 391 \n",
       "Q 2594 391 2855 752 \n",
       "Q 3116 1113 3116 1747 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-6f\" d=\"M 1959 3097 \n",
       "Q 1497 3097 1228 2736 \n",
       "Q 959 2375 959 1747 \n",
       "Q 959 1119 1226 758 \n",
       "Q 1494 397 1959 397 \n",
       "Q 2419 397 2687 759 \n",
       "Q 2956 1122 2956 1747 \n",
       "Q 2956 2369 2687 2733 \n",
       "Q 2419 3097 1959 3097 \n",
       "z\n",
       "M 1959 3584 \n",
       "Q 2709 3584 3137 3096 \n",
       "Q 3566 2609 3566 1747 \n",
       "Q 3566 888 3137 398 \n",
       "Q 2709 -91 1959 -91 \n",
       "Q 1206 -91 779 398 \n",
       "Q 353 888 353 1747 \n",
       "Q 353 2609 779 3096 \n",
       "Q 1206 3584 1959 3584 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-63\" d=\"M 3122 3366 \n",
       "L 3122 2828 \n",
       "Q 2878 2963 2633 3030 \n",
       "Q 2388 3097 2138 3097 \n",
       "Q 1578 3097 1268 2742 \n",
       "Q 959 2388 959 1747 \n",
       "Q 959 1106 1268 751 \n",
       "Q 1578 397 2138 397 \n",
       "Q 2388 397 2633 464 \n",
       "Q 2878 531 3122 666 \n",
       "L 3122 134 \n",
       "Q 2881 22 2623 -34 \n",
       "Q 2366 -91 2075 -91 \n",
       "Q 1284 -91 818 406 \n",
       "Q 353 903 353 1747 \n",
       "Q 353 2603 823 3093 \n",
       "Q 1294 3584 2113 3584 \n",
       "Q 2378 3584 2631 3529 \n",
       "Q 2884 3475 3122 3366 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-68\" d=\"M 3513 2113 \n",
       "L 3513 0 \n",
       "L 2938 0 \n",
       "L 2938 2094 \n",
       "Q 2938 2591 2744 2837 \n",
       "Q 2550 3084 2163 3084 \n",
       "Q 1697 3084 1428 2787 \n",
       "Q 1159 2491 1159 1978 \n",
       "L 1159 0 \n",
       "L 581 0 \n",
       "L 581 4863 \n",
       "L 1159 4863 \n",
       "L 1159 2956 \n",
       "Q 1366 3272 1645 3428 \n",
       "Q 1925 3584 2291 3584 \n",
       "Q 2894 3584 3203 3211 \n",
       "Q 3513 2838 3513 2113 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-65\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-70\" x=\"61.523438\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"125\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-63\" x=\"186.181641\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-68\" x=\"241.162109\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"matplotlib.axis_2\">\n",
       "    <g id=\"ytick_1\">\n",
       "     <g id=\"line2d_11\">\n",
       "      <path d=\"M 56.50625 141.672296 \n",
       "L 251.80625 141.672296 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_12\">\n",
       "      <defs>\n",
       "       <path id=\"mdfb18f304a\" d=\"M 0 0 \n",
       "L -3.5 0 \n",
       "\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </defs>\n",
       "      <g>\n",
       "       <use xlink:href=\"#mdfb18f304a\" x=\"56.50625\" y=\"141.672296\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_7\">\n",
       "      <!-- 0.225 -->\n",
       "      <g transform=\"translate(20.878125 145.471514)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-2e\" d=\"M 684 794 \n",
       "L 1344 794 \n",
       "L 1344 0 \n",
       "L 684 0 \n",
       "L 684 794 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "        <path id=\"DejaVuSans-35\" d=\"M 691 4666 \n",
       "L 3169 4666 \n",
       "L 3169 4134 \n",
       "L 1269 4134 \n",
       "L 1269 2991 \n",
       "Q 1406 3038 1543 3061 \n",
       "Q 1681 3084 1819 3084 \n",
       "Q 2600 3084 3056 2656 \n",
       "Q 3513 2228 3513 1497 \n",
       "Q 3513 744 3044 326 \n",
       "Q 2575 -91 1722 -91 \n",
       "Q 1428 -91 1123 -41 \n",
       "Q 819 9 494 109 \n",
       "L 494 744 \n",
       "Q 775 591 1075 516 \n",
       "Q 1375 441 1709 441 \n",
       "Q 2250 441 2565 725 \n",
       "Q 2881 1009 2881 1497 \n",
       "Q 2881 1984 2565 2268 \n",
       "Q 2250 2553 1709 2553 \n",
       "Q 1456 2553 1204 2497 \n",
       "Q 953 2441 691 2322 \n",
       "L 691 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_2\">\n",
       "     <g id=\"line2d_13\">\n",
       "      <path d=\"M 56.50625 115.53768 \n",
       "L 251.80625 115.53768 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_14\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mdfb18f304a\" x=\"56.50625\" y=\"115.53768\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_8\">\n",
       "      <!-- 0.250 -->\n",
       "      <g transform=\"translate(20.878125 119.336899)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_3\">\n",
       "     <g id=\"line2d_15\">\n",
       "      <path d=\"M 56.50625 89.403065 \n",
       "L 251.80625 89.403065 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_16\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mdfb18f304a\" x=\"56.50625\" y=\"89.403065\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_9\">\n",
       "      <!-- 0.275 -->\n",
       "      <g transform=\"translate(20.878125 93.202284)scale(0.1 -0.1)\">\n",
       "       <defs>\n",
       "        <path id=\"DejaVuSans-37\" d=\"M 525 4666 \n",
       "L 3525 4666 \n",
       "L 3525 4397 \n",
       "L 1831 0 \n",
       "L 1172 0 \n",
       "L 2766 4134 \n",
       "L 525 4134 \n",
       "L 525 4666 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       </defs>\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-37\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_4\">\n",
       "     <g id=\"line2d_17\">\n",
       "      <path d=\"M 56.50625 63.26845 \n",
       "L 251.80625 63.26845 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_18\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mdfb18f304a\" x=\"56.50625\" y=\"63.26845\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_10\">\n",
       "      <!-- 0.300 -->\n",
       "      <g transform=\"translate(20.878125 67.067668)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_5\">\n",
       "     <g id=\"line2d_19\">\n",
       "      <path d=\"M 56.50625 37.133834 \n",
       "L 251.80625 37.133834 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_20\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mdfb18f304a\" x=\"56.50625\" y=\"37.133834\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_11\">\n",
       "      <!-- 0.325 -->\n",
       "      <g transform=\"translate(20.878125 40.933053)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-32\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"ytick_6\">\n",
       "     <g id=\"line2d_21\">\n",
       "      <path d=\"M 56.50625 10.999219 \n",
       "L 251.80625 10.999219 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n",
       "     </g>\n",
       "     <g id=\"line2d_22\">\n",
       "      <g>\n",
       "       <use xlink:href=\"#mdfb18f304a\" x=\"56.50625\" y=\"10.999219\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "     <g id=\"text_12\">\n",
       "      <!-- 0.350 -->\n",
       "      <g transform=\"translate(20.878125 14.798437)scale(0.1 -0.1)\">\n",
       "       <use xlink:href=\"#DejaVuSans-30\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-2e\" x=\"63.623047\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-33\" x=\"95.410156\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-35\" x=\"159.033203\"/>\n",
       "       <use xlink:href=\"#DejaVuSans-30\" x=\"222.65625\"/>\n",
       "      </g>\n",
       "     </g>\n",
       "    </g>\n",
       "    <g id=\"text_13\">\n",
       "     <!-- loss -->\n",
       "     <g transform=\"translate(14.798438 88.607031)rotate(-90)scale(0.1 -0.1)\">\n",
       "      <defs>\n",
       "       <path id=\"DejaVuSans-6c\" d=\"M 603 4863 \n",
       "L 1178 4863 \n",
       "L 1178 0 \n",
       "L 603 0 \n",
       "L 603 4863 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "       <path id=\"DejaVuSans-73\" d=\"M 2834 3397 \n",
       "L 2834 2853 \n",
       "Q 2591 2978 2328 3040 \n",
       "Q 2066 3103 1784 3103 \n",
       "Q 1356 3103 1142 2972 \n",
       "Q 928 2841 928 2578 \n",
       "Q 928 2378 1081 2264 \n",
       "Q 1234 2150 1697 2047 \n",
       "L 1894 2003 \n",
       "Q 2506 1872 2764 1633 \n",
       "Q 3022 1394 3022 966 \n",
       "Q 3022 478 2636 193 \n",
       "Q 2250 -91 1575 -91 \n",
       "Q 1294 -91 989 -36 \n",
       "Q 684 19 347 128 \n",
       "L 347 722 \n",
       "Q 666 556 975 473 \n",
       "Q 1284 391 1588 391 \n",
       "Q 1994 391 2212 530 \n",
       "Q 2431 669 2431 922 \n",
       "Q 2431 1156 2273 1281 \n",
       "Q 2116 1406 1581 1522 \n",
       "L 1381 1569 \n",
       "Q 847 1681 609 1914 \n",
       "Q 372 2147 372 2553 \n",
       "Q 372 3047 722 3315 \n",
       "Q 1072 3584 1716 3584 \n",
       "Q 2034 3584 2315 3537 \n",
       "Q 2597 3491 2834 3397 \n",
       "z\n",
       "\" transform=\"scale(0.015625)\"/>\n",
       "      </defs>\n",
       "      <use xlink:href=\"#DejaVuSans-6c\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-6f\" x=\"27.783203\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-73\" x=\"88.964844\"/>\n",
       "      <use xlink:href=\"#DejaVuSans-73\" x=\"141.064453\"/>\n",
       "     </g>\n",
       "    </g>\n",
       "   </g>\n",
       "   <g id=\"line2d_23\">\n",
       "    <path d=\"M 63.01625 80.863119 \n",
       "L 69.52625 108.370486 \n",
       "L 76.03625 117.175262 \n",
       "L 82.54625 120.47558 \n",
       "L 89.05625 122.444176 \n",
       "L 95.56625 122.412163 \n",
       "L 102.07625 123.303378 \n",
       "L 108.58625 120.843949 \n",
       "L 115.09625 121.244221 \n",
       "L 121.60625 122.785761 \n",
       "L 128.11625 122.410108 \n",
       "L 134.62625 123.022349 \n",
       "L 141.13625 123.436755 \n",
       "L 147.64625 123.311493 \n",
       "L 154.15625 122.876219 \n",
       "L 160.66625 123.834294 \n",
       "L 167.17625 123.608343 \n",
       "L 173.68625 122.184823 \n",
       "L 180.19625 122.988632 \n",
       "L 186.70625 121.976054 \n",
       "L 193.21625 122.306233 \n",
       "L 199.72625 124.015091 \n",
       "L 206.23625 122.7583 \n",
       "L 212.74625 124.07914 \n",
       "L 219.25625 124.023263 \n",
       "L 225.76625 123.940774 \n",
       "L 232.27625 123.84473 \n",
       "L 238.78625 123.699197 \n",
       "L 245.29625 124.055371 \n",
       "L 251.80625 123.350881 \n",
       "\" clip-path=\"url(#pd5c0c21b34)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_3\">\n",
       "    <path d=\"M 56.50625 146.899219 \n",
       "L 56.50625 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_4\">\n",
       "    <path d=\"M 251.80625 146.899219 \n",
       "L 251.80625 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_5\">\n",
       "    <path d=\"M 56.50625 146.899219 \n",
       "L 251.80625 146.899219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "   <g id=\"patch_6\">\n",
       "    <path d=\"M 56.50625 10.999219 \n",
       "L 251.80625 10.999219 \n",
       "\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n",
       "   </g>\n",
       "  </g>\n",
       " </g>\n",
       " <defs>\n",
       "  <clipPath id=\"pd5c0c21b34\">\n",
       "   <rect x=\"56.50625\" y=\"10.999219\" width=\"195.3\" height=\"135.9\"/>\n",
       "  </clipPath>\n",
       " </defs>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<Figure size 252x180 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "trainer = mindspore.nn.Adagrad\n",
    "d2l.train_concise_ch11(trainer, {'learning_rate': 0.1}, data_iter)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2e2b346e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
